package org.footballmanager.pandafootball.system.controller.hy;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.footballmanager.pandafootball.common.constants.Constants;
import org.footballmanager.pandafootball.system.controller.BaseController;
import org.footballmanager.pandafootball.system.domain.FootYys;
import org.footballmanager.pandafootball.system.form.impl.FootYysSearchForm;
import org.footballmanager.pandafootball.system.service.FootYysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import java.util.List;

@Controller
@SessionAttributes("footYysSearchForm")
@RequestMapping("/hy/footYys")
public class HyYysController extends BaseController {
	/* 实体名称 */
	private static final String ENTITYNAME = "footYys";
	private static final String LISTPAGE = String.format(Constants.LISTPAGE, Constants.HY, ENTITYNAME);

	@Autowired
	private FootYysService footYysService;

    /**
     * 初始化
     * @param map 参数
     * @param footYysSearchForm 条件参数
     */
    @ModelAttribute
    public void init(Model map, @ModelAttribute FootYysSearchForm footYysSearchForm){
        FootYysSearchForm newFootYysSearchForm = new FootYysSearchForm();
        if(footYysSearchForm != null){
            newFootYysSearchForm = footYysSearchForm;
        }
        map.addAttribute(String.format(Constants.FORMNAME, ENTITYNAME), newFootYysSearchForm);
    }

	@RequestMapping(value="/search")
	public String search(Model map, @ModelAttribute FootYysSearchForm footYysSearchForm) {
        footYysService.search(ENTITYNAME, map, footYysSearchForm);
        return LISTPAGE;
	}
	
}
